<!DOCTYPE html >
<html>
<head>
<title>超级管理员登录</title> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
        <meta name="format-detection" content="telephone=no">
        <meta charset="UTF-8">
<script type="text/javascript" src="js/jquery-3-2-1.js"></script>
<!--<script type="text/javascript" src="login/images/login.js"></script>-->
<link href="login/css/login2.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
	body{
        		text-align: center;
        		background-image: url(img/body/blue.jpg);
        		/*background-size: 100% 100%;*/
        	}
</style>
<body>
<h1>管理员登录<sup>V2017</sup></h1>

<div class="login" style="margin-top:50px;">
    
    <!--<div class="header">-->
        <!--<div class="switch" id="switch">
        	<a class="switch_btn_focus" id="switch_qlogin"  >快速登录</a>
			<a class="switch_btn" id="switch_login" >快速注册</a>
			<div class="switch_bottom" id="switch_bottom" style="position: absolute; width: 64px; left: 0px;">
				
			</div>
        </div>-->
        
        
    <!--</div>-->    
  
    
    <div class="web_qr_login" id="web_qr_login" style="display: block; height: 235px;">    

            <!--登录-->
            <div class="web_login" id="web_login">
               
               
               <div class="login-box">
    
            
			<div class="login_form">
				<form  name="loginform" accept-charset="utf-8" id="login_form" class="loginForm" method="post"><input type="hidden" name="did" value="0"/>
               <input type="hidden" name="to" value="log"/>
                <div class="uinArea" id="uinArea">
                <label class="input-tips" for="user_login">帐号：</label>
                <div class="inputOuter" id="uArea">
                    
                    <input type="text" id="user_login" name="username" class="inputstyle"/>
                </div>
                </div>
                <div class="pwdArea" id="pwdArea">
               <label class="input-tips" for="password_login">密码：</label> 
               <div class="inputOuter" id="pArea">
                    
                    <input type="password" id="password_login" name="password_login" class="inputstyle"/>
                </div>
                </div>
               
                <div style="padding-left:50px;margin-top:20px;"><input type="button" value="登 录" id="Login" style="width:150px;" class="button_blue"/></div>
              </form>
           </div>
           
            	</div>
               
            </div>
            <!--登录end-->
  </div>

  <!--注册-->
    <!--<div class="qlogin" id="qlogin" style="display: none; ">
    
    <div class="web_login"><form name="form2" id="regUser" accept-charset="utf-8"  method="post">
	      <input type="hidden" name="to" value="reg"/>
		      		       <input type="hidden" name="did" value="0"/>
        <ul class="reg_form" id="reg-ul">
        		<div id="userCue" class="cue">快速注册请注意格式</div>
                <li>
                	
                    <label for="user"  class="input-tips2">用户名：</label>
                    <div class="inputOuter2">
                        <input type="text" id="user" name="user" maxlength="16" class="inputstyle2"/>
                    </div>
                    
                </li>
                
                <li>
                <label for="passwd" class="input-tips2">密码：</label>
                    <div class="inputOuter2">
                        <input type="password" id="passwd"  name="passwd" maxlength="16" class="inputstyle2"/>
                    </div>
                    
                </li>
                <li>
                <label for="passwd2" class="input-tips2">确认密码：</label>
                    <div class="inputOuter2">
                        <input type="password" id="passwd2" name="" maxlength="16" class="inputstyle2" />
                    </div>
                    
                </li>
                
                <li>
                 
                
                <li>
                    <div class="inputArea">
                        <input type="button" id="reg"  style="margin-top:10px;margin-left:85px;" class="button_blue" value="同意协议并注册"/> <a href="#" class="zcxy" target="_blank">注册协议</a>
                    </div>
                    
                </li><div class="cl"></div>
            </ul></form>
           
    
    </div>
  
    
    </div>-->
    <!--注册end-->
</div>
<script src="layer-v3.1.0/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<script src="js/urlConfig.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(function(){
	
	$('#switch_qlogin').click(function(){
		$('#switch_login').removeClass("switch_btn_focus").addClass('switch_btn');
		$('#switch_qlogin').removeClass("switch_btn").addClass('switch_btn_focus');
		$('#switch_bottom').animate({left:'0px',width:'70px'});
		$('#qlogin').css('display','none');
		$('#web_qr_login').css('display','block');
		
		});
	$('#switch_login').click(function(){
		
		$('#switch_login').removeClass("switch_btn").addClass('switch_btn_focus');
		$('#switch_qlogin').removeClass("switch_btn_focus").addClass('switch_btn');
		$('#switch_bottom').animate({left:'154px',width:'70px'});
		
		$('#qlogin').css('display','block');
		$('#web_qr_login').css('display','none');
		});
if(getParam("a")=='0')
{
	$('#switch_login').trigger('click');
}

	});
	
function logintab(){
	scrollTo(0);
	$('#switch_qlogin').removeClass("switch_btn_focus").addClass('switch_btn');
	$('#switch_login').removeClass("switch_btn").addClass('switch_btn_focus');
	$('#switch_bottom').animate({left:'154px',width:'96px'});
	$('#qlogin').css('display','none');
	$('#web_qr_login').css('display','block');
	
}


//根据参数名获得该参数 pname等于想要的参数名 
function getParam(pname) { 
    var params = location.search.substr(1); // 获取参数 平且去掉？ 
    var ArrParam = params.split('&'); 
    if (ArrParam.length == 1) { 
        //只有一个参数的情况 
        return params.split('=')[1]; 
    } 
    else { 
         //多个参数参数的情况 
        for (var i = 0; i < ArrParam.length; i++) { 
            if (ArrParam[i].split('=')[0] == pname) { 
                return ArrParam[i].split('=')[1]; 
            } 
        } 
    } 
}  


var reMethod = "POST",
	pwdmin = 5;

$(document).ready(function() {


	$('#reg').click(function() {

		if ($('#user').val() == "") {
			$('#user').focus().css({
				border: "1px solid red",
				boxShadow: "0 0 2px red"
			});
			$('#userCue').html("<font color='red'><b>×用户名不能为空</b></font>");
			return false;
		}



		if ($('#user').val().length < 4 || $('#user').val().length > 16) {

			$('#user').focus().css({
				border: "1px solid red",
				boxShadow: "0 0 2px red"
			});
			$('#userCue').html("<font color='red'><b>×用户名位4-16字符</b></font>");
			return false;
			
		}
		if ($('#passwd').val().length < pwdmin) {
			$('#passwd').focus();
			$('#userCue').html("<font color='red'><b>×密码不能小于" + pwdmin + "位</b></font>");
			return false;
		}
		if ($('#passwd2').val() != $('#passwd').val()) {
			$('#passwd2').focus();
			$('#userCue').html("<font color='red'><b>×两次密码不一致！</b></font>");
			return false;
		}
		$.ajax({
			type: reMethod,
			url: url+"register",
			
			dataType: 'json',
			data: {
				"username":$('#user').val(),
				"password":$('#passwd').val()
			},
			success: function(data, result) {
//				console.log("进来了")
//				console.log(result)
//				console.log(Object)
//				console.log(data)
//				console.log(data.errorCode)
//				console.log(data.message)
				if (result == "success" && data.errorCode=="-1") {
					$('#user').focus().css({
						border: "1px solid red",
						boxShadow: "0 0 2px red"
					});$("#userCue").html(data.message);
					
				} 
				if (data.errorCode=="1"){
					layer.msg("注册成功!正准备跳往登录界面！");
	        		setTimeout( function(){
				    layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
				    
					}, 2000);//延迟1500毫米
					layer.closeAll('loading'); //关闭加载层
	        		setTimeout( function(){
					    window.location.href="loginOk.html";
					}, 5000);//延迟1500毫米
					
				}
//				
				
			}
		});

//		var sqq = /^[1-9]{1}[0-9]{4,9}$/;
		

//		$('#regUser').submit();
	});
	

});


$(document).ready(function() {


	$('#Login').click(function() {

		if ($('#user_login').val() == "") {
			$('#user_login').focus().css({
				border: "1px solid red",
				boxShadow: "0 0 2px red"
			});
			layer.msg("用户名不能为空！");
			return false;
		}



		if ($('#user_login').val().length < 4 || $('#user_login').val().length > 16) {

			$('#user_login').focus().css({
				border: "1px solid red",
				boxShadow: "0 0 2px red"
			});
			layer.msg("用户名字符必须为4至16位！");
			return false;
			
		}
		if ($('#password_login').val().length < pwdmin) {
			$('#password_login').focus();
			layer.msg("密码不能少于" + pwdmin + "位");
			return false;
		}
		console.log($('#user_login').val());
		console.log($('#passwd_login').val());
		$.ajax({
			type: reMethod,
			url: url+"webLogin",
			
			dataType: 'json',
			data: {
				"username":$('#user_login').val(),
				"password":$('#password_login').val()
			},
			success: function(data, result) {
				console.log("进来了")
				console.log(result)
				console.log(Object)
				console.log(data)
				console.log(data.errorCode)
				console.log(data.message)
//				console.log(success)
				if (result == "success" && data.errorCode=="-1") {
					
					layer.msg("登录失败：用户名错不存在或者密码错误！");
				} 
				if (data.errorCode=="1"){
					layer.msg("登入成功!正准备跳往主界面！");
	        		setTimeout( function(){
				    layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
				    
					}, 2000);//延迟1500毫米
					layer.closeAll('loading'); //关闭加载层
	        		setTimeout( function(){
					    window.location.href="asset_management.html";
					}, 5000);//延迟1500毫米
					
				}
//				
				
			}
		});

//		var sqq = /^[1-9]{1}[0-9]{4,9}$/;
		

//		$('#regUser').submit();
	});
	

});


</script>
</body></html>